/**
 * @brief LightOnOff 开关设备类型
 */
#pragma once

#include "BridgedDevice.h"

class LightOnOff : public BridgedDevice
{
public:
    static constexpr DeviceTypeId kDeviceTypeOnOffLight = 0x0100;
    static constexpr DeviceTypeId kDeviceTypeOnOffSwitch = 0x0103;
    explicit LightOnOff(const BasicInformation* node);

    [[nodiscard]] bool IsOn() const;
    void SetOnOff(bool on);
    void UpdateOnOff(bool on);

    Protocols::InteractionModel::Status  ReadAttribute(
        ClusterId clusterId,
        AttributeId attributeId,
        uint8_t* buffer,
        uint16_t maxReadLength) override;

    Protocols::InteractionModel::Status  WriteAttribute(
        ClusterId clusterId,
        const EmberAfAttributeMetadata* attributeMetadata,
        uint8_t* buffer) override;

    ChipError OnReport(const DataBlock* block) override;
    ChipError OnReadAttributes() override;

private:
    bool mOn;
};
